<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.Arrays"%>
<%
String reason = request.getParameter("reason");
String message = null;
boolean[] reEnter = new boolean[6];
Arrays.fill(reEnter, false);
try {
	if (reason != null) {
		int type = Integer.parseInt(reason);
		if (type > 0 && type < 7) {
			reEnter[type - 1] = true;
			message = "请确认没有输入错误";
		}
	}
} catch (NumberFormatException e) {}
%>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="css/reg.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/reg.js"></script>
<script type="text/javascript" src="js/json.js"></script>
<script type="text/javascript" src="js/passwordstrength.js"></script>
<title>新用户注册</title>
</head>
<body>
<div class="regmain">
<form name="form1" method="post" action="user.do" onsubmit="return checkRegister()">
<input type="hidden" name="action" value="register" />
	<div class="regitem">
		<div class="regtitle"><%= message != null ? message : "" %></div>
	</div>
	<div class="regitem">
		<div class="reglabel<%= reEnter[0] ? "error" : "" %>">用户名：</div>
		<div class="reginput">
			<input type="text" class="inputarea" onblur="checkUsername(this)" name="username" id="username" value="<%= reEnter[3] ? "这个用户名已经被使用" : "" %>" />
			<span id="usernamemsg"></span>
		</div>
	</div>
	<div class="regitem">
		<div class="reglabel<%= reEnter[1] ? "error" : "" %>">密码：</div>
		<div class="reginput">
			<input type="password" class="inputarea" name="password" id="password" onfocus="showPSField()" onkeyup="ps.update(this.value);" />
			<div id="psfield">
			<script language="javascript">
				var ps = new PasswordStrength();
				ps.setSize('200', '20');
				ps.setMinLength(1);
			</script>
			</div>
		</div>
	</div>
	<div class="regitem">
		<div class="reglabel">确认密码：</div>
		<div class="reginput">
			<input type="password" class="inputarea" onblur="checkPassword(this)" name="repassword" id="repassword" />
			<span id="psmsg"></span>
		</div>
	</div>
	<div class="regitem">
		<div class="reglabel<%= reEnter[2] ? "error" : "" %>">电子邮件：</div>
		<div class="reginput">
			<input type="text" class="inputarea" onblur="checkEmail(this)" name="email" id="email" value="<%= reEnter[4] ? "这个电子邮件已经被使用" : "" %>" />
			<span id="emailmsg"></span>
		</div>
	</div>
	<div class="regitem">
		<div class="reglabel<%= reEnter[5] ? "error" : "" %>">验证码：</div>
		<div class="reginput">
			<img src="code.jpg" id="captcha" />
			<div class="capinput">
	      		<input type="text" name="captchacode" id="captchacode" />
	      		<a class="fakelink" onclick="refreshCaptcha()">看不清</a>
	      	</div>
      	</div>
	</div>
	<div class="regitem">
		<div class="reglabel">
			<input type="checkbox" name="agree" id="agree" />
		</div>
		<div class="reginput">阅读并接受
			<a href="agreement.html" target="_blank">用户许可协议</a>
		</div>
	</div>
	<div class="regitem">
		<input type="submit" class="submitbutton" name="reg" value="注册" />
	</div>
</form>
</div>
</body>
</html>